<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>

    var date = new Date()

    // 1.使用类方法now
    var timestamp1 = Date.now()
    console.log(timestamp1)


    // 2.讲一个date对象转为时间戳
    var timestamp2 = date.getTime()
    console.log(timestamp2)

    // 3.将字符串时间转为时间戳
    var timestamp3 = Date.parse("2033-03-23")
    console.log(timestamp3)
  </script>
</body>
</html>